package cn.limc.ohoscharts.demo.slice;

import cn.limc.ohoscharts.demo.ResourceTable;
import cn.limc.ohoscharts.entity.TitleValueColorEntity;
import cn.limc.ohoscharts.view.RoseChart;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;

import java.util.ArrayList;
import java.util.List;

public class RoseChartAbility extends AbilitySlice {

  RoseChart rosechart;

  @Override
  public void onStart(Intent intent) {
    super.onStart(intent);
    super.setUIContent(ResourceTable.Layout_ability_rose_chart);
    initRoseChart();
  }

  private void initRoseChart() {
    this.rosechart = (RoseChart) findComponentById(ResourceTable.Id_rosechart);
    List<TitleValueColorEntity> data3 = new ArrayList<TitleValueColorEntity>();
    data3.add(new TitleValueColorEntity("Alpha", 1,
        0xFFFF0000));
    data3.add(new TitleValueColorEntity("Alpha", 2,
        0xFFFF8D00));
    data3.add(new TitleValueColorEntity("Alpha", 3,
        0xFFFFFF00));
    data3.add(new TitleValueColorEntity("Delta", 4,
        0xFF00FF00));
    data3.add(new TitleValueColorEntity("Echo", 5,
        0xFF0000FF));
    data3.add(new TitleValueColorEntity("Fox", 6,
        0xFFFFC0CB));
    rosechart.setData(data3);
  }
}
